import { Photo } from 'src/photo/photo.entity';
import { User } from 'src/user/user.entity';
import { Column, Entity, PrimaryGeneratedColumn, ManyToOne, JoinColumn, JoinTable } from 'typeorm';
@Entity('photo_like')
export class PhotoLike {
  /**
   * 自增主键
   */
  @PrimaryGeneratedColumn({
    comment: '自增ID'
  })
  id: number;

  @Column({
    comment: '用户id'
  })
  user_id: number;

  @Column({
    comment: '照片id'
  })
  photo_id: number;

  @Column({
    comment: '创建时间'
  })
  create_time: number;

  @Column({
    comment: '更新时间'
  })
  update_time: number;

  @Column({
    comment: '删除时间'
  })
  delete_time: number;

  @ManyToOne((type) => Photo, (photo) => photo.photo_like)
  @JoinColumn({ name: 'photo_id' })
  photo: Photo;

  @ManyToOne((type) => User, (user) => user.photo_like)
  @JoinColumn({ name: 'user_id' })
  user: User;
}